package cn.iocoder.yudao.module.pickbook.dal.mysql.user;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pickbook.dal.dataobject.user.PickUserDO;
import cn.iocoder.yudao.module.pickbook.controller.admin.user.vo.PickUserPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户 Mapper
 *
 * @author dingli
 */
@Mapper
public interface PickUserMapper extends BaseMapperX<PickUserDO> {

    default PageResult<PickUserDO> selectPage(PickUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PickUserDO>()
                .eqIfPresent(PickUserDO::getOpenid, reqVO.getOpenid())
                .likeIfPresent(PickUserDO::getNickname, reqVO.getNickname())
                .eqIfPresent(PickUserDO::getRole, reqVO.getRole())
                .eqIfPresent(PickUserDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PickUserDO::getIsMember, reqVO.getIsMember())
                .orderByDesc(PickUserDO::getId));
    }

}